package com.wondertek.poms.service.vo;

import com.wondertek.poms.common.utils.validate.GroupType;
import com.wondertek.poms.dao.pojo.EquityNodePojo;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.groups.Default;
import java.util.Collection;

@Data
public class EquityNodeVo {

    private Long id;// 权益节点id

    @Valid @NotNull(message = "权益树ID不能为空", groups = {Default.class, GroupType.Update.class})
    private Long treeId; // 权益树id 对应EquityTree的id

    @Valid @NotBlank(message = "权益树节点名不能为空", groups = {Default.class})
    @Length(message = "权益树节点名长度不能超过255个字节", max=255, groups = {Default.class, GroupType.Update.class})
    @Pattern(regexp="^\\w+$", message="节点名必须以字母、数字、下划线组成" ,groups = {Default.class, GroupType.Update.class, GroupType.Delete.class})
    private String name; //权益节点名

    @Valid @NotNull(message = "权益树父节点id不能为空", groups = {Default.class,GroupType.Update.class})
    private Long parentId;// 父权益节点 第一级的父权益节点 0

    //@Valid @NotBlank(message = "产品组id不能为空", groups = {Default.class})
    @Valid @NotNull(message = "产品组id不能为空", groups = {Default.class,GroupType.Update.class})
    private Long groupId; // 关联组id

    @Length(message = "权益树节点名长度不能超过255个字节", max=255, groups = {Default.class, GroupType.Update.class})
    private String nodeAlias;// 节点别名

    //  0 启用 1：禁用
    @Valid @NotBlank(message = "权益树节点状态不能为空", groups = {Default.class})
    @Pattern(regexp="[0-1]", message="状态只能为0或1" ,groups = {Default.class, GroupType.Update.class, GroupType.Delete.class})
    private String status;

    private Boolean expanded;

    private String parentEquityNodeId;
    private String updateTime;
    private Integer hierarchy; // 层级
    private String equityNodeId;// 权益节点编码
}
